package com.example.sb.pojo;

/**
 * @author kedong.lin
 */
public enum SexEnum {
    MAIL(1, "男"),
    FEMAIL(2, "女");
    private int code;
    private String name;

    SexEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static SexEnum getEnumById(int id) {

        for (SexEnum s : SexEnum.values()) {
            if (s.getCode() == id) {
                return s;
            }
        }
        return null;
    }
}
